﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Xml;
using TVGuide.DataAccess.Repository;
using TVGuide.DataAccess.Common;
using TVGuide.Common;

namespace TvGuide.UI.Models
{
    public class OnlineTVData
    {
        private int lang;
        private CommonStr comm_str;
        public List<ChannelVideoList> ChVideoList { get; set; }

        public CommonStr Comm_str
        {
            get { return this.comm_str; }
        }

        public OnlineTVData(int lng)
        {
            this.lang = lng;
            this.comm_str = new CommonStr(ResUtil.GetLang(lng));
            InitChannelsList();
        }
        
        private void InitChannelsList()
        {
            this.ChVideoList = new List<ChannelVideoList>();
            foreach (var ch in ProgramData.chlist)
            {
                if (ch.StreamUrl != null && ch.StreamUrl.Length > 0)
                    this.ChVideoList.Add(new ChannelVideoList() { ChName = ch.Name, ChDispName = ch.DispName, ChImgUrl = ch.ImgUrl, ChLink = ch.StreamUrl });
            }
        }
    }

    public class ChannelVideoList
    {
        public string ChName { get; set; }
        public string ChImgUrl { get; set; }
        public string ChDispName { get; set; }
        public string ChLink { get; set; }
    }
}
